package com.yc;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@MyAnno(100)
public class AnnoTest {

    @MyAnno(name = "abc",value = 100)
    public int getMax(int a,int b){
        return 0;
    }



    private int getMin(@MyAnno(100) int b){
        return 0;
    }

    public static void main(String[] args) {
        Class<AnnoTest> annoTestClass = AnnoTest.class;
        MyAnno annotation = annoTestClass.getAnnotation(MyAnno.class);

        System.out.println("myAnno = " +  annotation);


    }

}

@Target({ElementType.TYPE,
         ElementType.METHOD,
         ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@interface MyAnno{
    //以接口方法的语法定义注解的属性  允许没有属性的注解
    String name() default "abc";
    int value();
    char[] size() default {};
}
